var fileSize = imageFile.ContentLength; if ((fileSize / 1048576.0) > 10) { // image is too large }